#!/bin/sh

PID_FILE="/var/run/ndpd.pid"
RUN_FILE="`which ndpd_safe`"

stop() {
	if [ -f $PID_FILE ]; then
		kill -9 `cat $PID_FILE`;
	fi

	rm $PID_FILE
	exit 0
}

start() {
	if [ -f $PID_FILE ]; then
		echo "Already running, exiting!" && exit 1;
	fi
	
	sh $RUN_FILE
	echo -n $! > $PID_FILE;
}
	

case $1 in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	*)
		echo "Usage: /etc/init.d/$0 {start|stop|restart}"
		;;
esac

exit 0

